package cn.iocoder.yudao.module.etl.dal.dataobject;

import cn.hutool.core.codec.Base64;
import cn.hutool.json.JSON;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;


public class DatasetTable implements Serializable {
    @ApiModelProperty("ID")
    private String id;
    @ApiModelProperty("名称")
    private String name;
    @ApiModelProperty("场景ID")
    private String sceneId;
    @ApiModelProperty("数据源ID")
    private String dataSourceId;
    @ApiModelProperty("类型")
    private String type;
    @ApiModelProperty("模式")
    private Integer mode;
    @ApiModelProperty("信息")
    private String info;
    @ApiModelProperty("创建者")
    private String createBy;
    @ApiModelProperty("创建时间")
    private Long createTime;
    @ApiModelProperty("定时任务实例")
    private String qrtzInstance;
    @ApiModelProperty("同步状态")
    private String syncStatus;
    @ApiModelProperty("上次更新时间")
    private Long lastUpdateTime;

    private String sqlVariableDetails;

    private static final long serialVersionUID = 1L;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSceneId() {
        return sceneId;
    }

    public void setSceneId(String sceneId) {
        this.sceneId = sceneId;
    }

    public String getDataSourceId() {
        return dataSourceId;
    }

    public void setDataSourceId(String dataSourceId) {
        this.dataSourceId = dataSourceId;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Integer getMode() {
        return mode;
    }

    public void setMode(Integer mode) {
        this.mode = mode;
    }

    public String getInfo() {
        return info;
    }

    /**
     * 如果是base64加密的，那么解下密
     * @return
     */
//    public String getSql() {
//        JSONObject entries = JSONUtil.parseObj(info);
//        if(entries.get("isBase64Encryption") != null
//                &&  entries.get("isBase64Encryption").equals(true)){
//            return Base64.decodeStr(entries.get("sql").toString());
//        }else{
//            return entries.get("sql").toString();
//        }
//
//    }

    public void setInfo(String info) {
        this.info = info;
    }

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }

    public String getQrtzInstance() {
        return qrtzInstance;
    }

    public void setQrtzInstance(String qrtzInstance) {
        this.qrtzInstance = qrtzInstance;
    }

    public String getSyncStatus() {
        return syncStatus;
    }

    public void setSyncStatus(String syncStatus) {
        this.syncStatus = syncStatus;
    }

    public Long getLastUpdateTime() {
        return lastUpdateTime;
    }

    public void setLastUpdateTime(Long lastUpdateTime) {
        this.lastUpdateTime = lastUpdateTime;
    }

    public String getSqlVariableDetails() {
        return sqlVariableDetails;
    }

    public void setSqlVariableDetails(String sqlVariableDetails) {
        this.sqlVariableDetails = sqlVariableDetails;
    }
}